package com.dd.ms.auth.repository;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.dd.ms.auth.mapper.RolePermissionRelMapper;
import com.dd.ms.auth.pojo.DO.PermissionDO;
import com.dd.ms.auth.pojo.DO.UserRolesRelDO;
import com.dd.ms.auth.pojo.dto.RolePermissionDTO;
import com.dd.ms.auth.pojo.req.RolePersBatchAddReq;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.PropertyValues;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @Author liuxianmeng
 * @CreateTime 2025/7/9 16:00
 * @Description 角色 & 权限 关联操作 仓储层
 */
@Repository
@RequiredArgsConstructor
public class RolePermissionRelRepository {

    private final RolePermissionRelMapper rolePermissionRelMapper;

    /**
     * 添加角色权限关联
     *
     * @param params 参数应该包含角色和权限的id
     */
    public void addRolePermissionRel(Map<String, Object> params) {

    }

    /**
     * 批量添加角色权限关联
     * @param req 参数列表（每个Map包含roleId和perId）
     */
    public void batchAddRolePermissionRel(RolePersBatchAddReq req) {
        rolePermissionRelMapper.batchAddRolePermissionRel(req);
    }

    public List<RolePermissionDTO> getPermissionsByRoleIds(List<Long> roleIds) {
        return rolePermissionRelMapper.getPermissionsByRoleIds(roleIds);
    }
}
